package com.iaiai.calendar.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * 
 * <p>
 * Title: DatabaseOpenHelper.java
 * </p>
 * <p>
 * E-Mail: 176291935@qq.com
 * </p>
 * <p>
 * QQ: 176291935
 * </p>
 * <p>
 * Http: iaiai.iteye.com
 * </p>
 * <p>
 * Create time: 2011-12-9
 * </p>
 * 
 * @author 丸子
 * @version 0.0.1
 */
public class DatabaseOpenHelper extends SQLiteOpenHelper {

	private static final String DBNAME = "iaiai_calendar"; // 数据库名子

	private static final int VERSION = 1; // 版本

	public DatabaseOpenHelper(Context context, String name,
			CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	public DatabaseOpenHelper(Context context) {
		super(context, DBNAME, null, VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE LUNAR_CALENDAR(ID INTEGER PRIMARY KEY AUTOINCREMENT, SOLAR VARCHAR(20), SOLAR_INFO VARCHAR(20), LUNAR VARCHAR(20), CONSTELLATION VARCHAR(20), SOLAR_TERMS VARCHAR(20), WEEK VARCHAR(20), SHENGXIAO VARCHAR(10), YI VARCHAR(200), JI VARCHAR(200), XIONGSHENGYIJI VARCHAR(200),HOUR_23_1_NAME VARCHAR(20), HOUR_23_1 VARCHAR(200), HOUR_23_1_YI VARCHAR(200), HOUR_23_1_JI VARCHAR(200), HOUR_1_3_NAME VARCHAR(20), HOUR_1_3 VARCHAR(200), HOUR_1_3_YI VARCHAR(200), HOUR_1_3_JI VARCHAR(200), HOUR_3_5_NAME VARCHAR(20), HOUR_3_5 VARCHAR(200), HOUR_3_5_YI VARCHAR(200), HOUR_3_5_JI VARCHAR(200), HOUR_5_7_NAME VARCHAR(20), HOUR_5_7 VARCHAR(200), HOUR_5_7_YI VARCHAR(200), HOUR_5_7_JI VARCHAR(200), HOUR_7_9_NAME VARCHAR(20), HOUR_7_9 VARCHAR(200), HOUR_7_9_YI VARCHAR(200), HOUR_7_9_JI VARCHAR(200), HOUR_9_11_NAME VARCHAR(20), HOUR_9_11 VARCHAR(200), HOUR_9_11_YI VARCHAR(200), HOUR_9_11_JI VARCHAR(200), HOUR_11_13_NAME VARCHAR(20), HOUR_11_13 VARCHAR(200), HOUR_11_13_YI VARCHAR(200), HOUR_11_13_JI VARCHAR(200), HOUR_13_15_NAME VARCHAR(20), HOUR_13_15 VARCHAR(200), HOUR_13_15_YI VARCHAR(200), HOUR_13_15_JI VARCHAR(200), HOUR_15_17_NAME VARCHAR(20), HOUR_15_17 VARCHAR(200), HOUR_15_17_YI VARCHAR(200), HOUR_15_17_JI VARCHAR(200), HOUR_17_19_NAME VARCHAR(20), HOUR_17_19 VARCHAR(200), HOUR_17_19_YI VARCHAR(200), HOUR_17_19_JI VARCHAR(200), HOUR_19_21_NAME VARCHAR(20), HOUR_19_21 VARCHAR(200), HOUR_19_21_YI VARCHAR(200), HOUR_19_21_JI VARCHAR(200), HOUR_21_23_NAME VARCHAR(20), HOUR_21_23 VARCHAR(200), HOUR_21_23_YI VARCHAR(200), HOUR_21_23_JI VARCHAR(200))");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// 升级更新
		db.execSQL("DROP TABLE IF EXISTS LUNAR_CALENDAR");
		onCreate(db);
	}
}
